<if condition="is_login()">
    <!--弹出悄悄话聊天框-->
    <div id="repost_text" class="white-popup mfp-hide">
        <php>
            if(C('REPOST_WORDS_COUNT')){
            $Question_report_count=C('REPOST_WORDS_COUNT');
            }else{
            $Question_report_count=400;
            }
        </php>
        <div style="line-height: 30px;font-size: 20px;font-weight: 600;">转发</div>
        <div class="pull-left" style="line-height: 22px;font-size: 15px;margin-bottom: 4px;">标题：<span id="question_title"></span></div>
        <span class="pull-right show_num_repost" style="margin-right: 10px;">{$Question_report_count}</span>
        <div class="talk_box">
            <div>
                <input type="hidden" id="question-id" value="0">
                <textarea class="col-xs-12 form-control" id="repost_content" style="height: 100px;"
                          placeholder="说点什么吧，哪怕就一个逗号~" onfocus="startCheckNum_question($(this))"
                          onblur="endCheckNum_question()"></textarea>

                <div class="clearfix"></div>
                <div class="do_action" style="margin-top: 10px;">
                    <a href="javascript:" onclick="insertTalkFace($(this))"><img
                            class="weibo_type_icon"
                            src="__STATIC__/image/bq.png"/></a>
                    <input id="beanswer" checked type="checkbox" style="margin-left: 10px;">同时作为答案发布
                    <a type="submit" class="btn btn-primary" id="submit-button"
                       onclick="appendQuestion()"
                       style="float: right;background-color: #f36119;border-color: #f36119;color: #fff!important;">确定转发</a>
                </div>
            </div>
            <div id="emot_content" class="emot_content"></div>
        </div>
    </div>
    <script>
        var ID_setInterval_question;
        var initQuestionNum = "{:C('REPOST_WORDS_COUNT')}" ? "{:C('REPOST_WORDS_COUNT')}" : 400;
        function checkNum_question(obj) {
            var value = obj.val();
            var value_length = value.length;
            var can_in_num = initQuestionNum - value_length;
            if (can_in_num < 0) {
                value = value.substr(0, initQuestionNum);
                obj.val(value);
                value_length = initQuestionNum;
            }
            var html = value_length + '/' + initQuestionNum;
            $('.show_num_repost').html(html);
        }
        function startCheckNum_question(obj) {
            ID_setInterval_question = setInterval(function () {
                checkNum_question(obj);
            }, 250);
        }
        function endCheckNum_question() {
            clearInterval(ID_setInterval_question);
        }
        function appendQuestion() {
            var content= $.trim($('#repost_content').val());
            if(content.length==0){
                toast.error('输入内容不能为空！');
                return;
            }
            close_face();
            var question_id=$('#question-id').val();
            var beAnswer=$('#beanswer')[0].checked;
            $.post(U('question/index/repost'), {question_id:question_id,content: content,beAnswer:beAnswer?1:0}, function (msg) {
                if (msg.status==1) {
                    $('#repost_num_'+question_id).html(msg.repost_num);
                    $('#answer_num_'+question_id).html(msg.from_answer_num)
                    /*转发后展示在本页
                    if(msg.have_old_repost==1){
                        $('.old_question_repost_'+msg.first_question_id).html(msg.from_repost_num);
                    }
                    $('#question_list_append').prepend(msg.question);
                    ucard();*/
                    bindAll();
                    $('#repost_content').val('');
                    $('.show_num_repost').html(initQuestionNum);
                    toast.success('转发成功！');

                    $('.mfp-close').click();
                } else {
                    handleAjax(msg);
                }
            }, 'json');
        }

        $('#repost_content').keypress(function (e) {
            if (e.ctrlKey && e.which == 13 || e.which == 10) {
                appendQuestion();
            }
        });


    </script>
</if>